<template>
	<view>
		<topTitle/>
		<view class="content">
			<view class="f32 fw5">您好,</view>
			<view class="f16 mt8">欢迎来到灭霸云仓</view>
			<view class="btn">
				<input v-model="apiData.account" @blur="handPhone" placeholder="请输入账号" class="input"/>
				<input v-model="apiData.password" @blur="handPassWord" placeholder="请输入密码" class="input mt20"/>
				<view class="f12 color-6 mt17 flex j-c-f">
					<text @click="newPassWord">忘记密码，请联系管理员</text>
				</view>
				<view class="submit color-w f16 fw5" @click="handLogin">
					登录
				</view>
			</view>
		</view>
	</view>
</template>
<script>
export default {
  data() {
    return {
      apiData:{}
    }
  },
  onLoad() {
	if(uni.getStorageSync('userInfo')){
		console.log(123)
		this.util.go('/pages/index/index',3)
	}
  },
  methods: {
    handPhone(e){
      console.log(e,'手机号');
    },
    handPassWord(e){
      console.log(e,'密码');
    },
    newPassWord(){//忘记密码
			
    },
    async handLogin(){ //登录
      if(await this.util.verify(this.apiData)){
        this.util.req(this.api.apiLogin,this.apiData).then(res=>{
					console.log(this.apiData,'登录');
          if(!res) return
          wx.setStorageSync('userInfo',res.memberinfo)
          this.util.go('/pages/index/index',3)
				})
			}
		}
	}
}
</script>

<style lang="scss">
	.content{
		margin: 136rpx 64rpx;
		.btn{
			margin-top: 194rpx;
			.input{
				padding: 26rpx 0;
				border-bottom: 2rpx solid #EDEEF2;
			}
			.submit{
				height: 96rpx;
				line-height: 96rpx;
				text-align: center;
				background: var(--theme);
				border-radius: 16rpx;
				margin-top: 92rpx;
			}
		}
	}
	
	
</style>
